/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package JFreeChartExtensions.Series;

import org.jfree.data.xy.XYIntervalSeries;

/**
 *
 * @author Nobody
 */
public class XYExtendedIntervalSeries extends XYIntervalSeries {

    private int slot;

    public int getSlot() {
        return slot;
    }

    public XYExtendedIntervalSeries(Comparable key, boolean autoSort, boolean allowDuplicateXValues, int slot) {
        super(key, autoSort, allowDuplicateXValues);
        this.slot = slot;
    }

    public XYExtendedIntervalSeries(Comparable key, boolean autoSort, int slot) {
        super(key, autoSort, true);
        this.slot = slot;
    }

    public XYExtendedIntervalSeries(Comparable key, int slot) {
        super(key);
        this.slot = slot;
    }

    public XYExtendedIntervalSeries(Comparable key, boolean autoSort, boolean allowDuplicateXValues) {
        this(key, autoSort, allowDuplicateXValues, -1);
    }

    public XYExtendedIntervalSeries(Comparable key, boolean autoSort) {
        this(key, autoSort, true, -1);
    }

    public XYExtendedIntervalSeries(Comparable key) {
        this(key, -1);
    }

    public double getMinX() {
        double min = Double.MAX_VALUE;
        for (int i = 0; i < getItemCount(); ++i) {
            if (getX(i).doubleValue() < min) {
                min = getX(i).doubleValue();
            }
        }
        return min;
    }

    public void add(double x, double y) {
        super.add(x, x, x, y, y, y);
    }

    public double getMaxX() {
        double max = Double.MIN_VALUE;
        for (int i = 0; i < getItemCount(); ++i) {
            if (getX(i).doubleValue() > max) {
                max = getX(i).doubleValue();
            }
        }
        return max;

    }

    public double getMinY() {
        double min = Double.MAX_VALUE;
        for (int i = 0; i < getItemCount(); ++i) {
            if (getYValue(i) < min) {
                min = getYValue(i);
            }
        }
        return min;
    }

    public double getMaxY() {
        double max = Double.MIN_VALUE;
        for (int i = 0; i < getItemCount(); ++i) {
            if (getYValue(i) > max) {
                max = getYValue(i);
            }
        }
        return max;
    }
}
